<!DOCTYPE html>
<html>
<head>
    <title></title>
    <#include "/header.html"/>
    <link rel="stylesheet" type="text/css"
          href="${request.contextPath}/statics/fancybox/source/jquery.fancybox.css?v=2.1.5" media="screen"/>
    <script type="text/javascript"
            src="${request.contextPath}/statics/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
    <script type="text/javascript"
            src="${request.contextPath}/statics/fancybox/source/jquery.fancybox.js?v=2.1.5"></script>
    <style type="text/css">
        html{
            overflow-y:auto;
        }
        .fancybox-custom .fancybox-skin {
            box-shadow: 0 0 50px #222;
        }

        /*body {*/
        /*max-width: 1100px;*/
        /*margin: 90px auto 0;*/
        /*}*/

        h3 {
            color: #333;
            font-family: 'Microsoft Yahei';
            font-size: 26px;
        }
        html {
            overflow-y: auto;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $('.fancybox').fancybox();
        });
    </script>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <#if shiro.hasPermission("onlinestudy:question:save")>
                <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>
            <#if shiro.hasPermission("onlinestudy:question:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("onlinestudy:question:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default" align="center">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width:70%!important;" id="questionForm">
            <input type="hidden" v-model="question.id" name="id"/>
            <div class="form-group">
                <div class="col-sm-2 control-label">题目标题</div>
                <div class="col-sm-10">
                    <textarea name="title" class="form-control" width="80%" v-model="question.title" placeholder="题目标题"></textarea>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">题目类型</div>
                <div class="col-sm-10">
                    <select class="form-control" v-model="question.questionType" name="questionType">
                        <option value="" disabled>请选择题目类型</option>
                        <option value="0">单选</option>
                        <option value="1">判断</option>
                        <option value="2">多选</option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">题目图片</div>
                <div class="col-sm-10">
                    <input name="imageFile" style="width:100%;border: 2px;" type="file" v-model="question.imageFile"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">图片预览</div>
                <div class="col-sm-10">
                    <a class="fancybox" :href="question.image" data-fancybox-group="gallery" title="">
                    <img style="width:120px;height: 90px;" :src="question.image"/>
                    </a>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">选项A</div>
                <div class="col-sm-10">
                    <input name="answerA" type="text" class="form-control" width="80%" v-model="question.answerA" placeholder="选项A"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">选项B</div>
                <div class="col-sm-10">
                    <input type="text" name="answerB" class="form-control" width="80%" v-model="question.answerB" placeholder="选项B"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">选项C</div>
                <div class="col-sm-10">
                    <input name="answerC" type="text" class="form-control" width="80%" v-model="question.answerC" placeholder="选项C"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">选项D</div>
                <div class="col-sm-10">
                    <input name="answerD" type="text" class="form-control" width="80%" v-model="question.answerD" placeholder="选项D"/>
                </div>
            </div>
            <div class="form-group" style="display: inline">
                <div class="col-sm-2 control-label">答案</div>
                <div class="col-sm-10">
                    <span class="col-sm-2">
                    <input name="isAnswerA" type="checkbox" v-model="question.isAnswerA"
                           placeholder=""/>答案A</span>
                    <span class="col-sm-2">
                    <input name="isAnswerB" type="checkbox" v-model="question.isAnswerB"
                           placeholder=""/>答案B</span>
                    <span class="col-sm-2">
                    <input name="isAnswerC" type="checkbox" v-model="question.isAnswerC"
                           placeholder=""/>答案C</span>
                    <span class="col-sm-2">
                    <input name="isAnswerD" type="checkbox" v-model="question.isAnswerD"
                           placeholder=""/>答案D</span>
                    <span class="col-sm-2"></span>
            </div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <span style="color:red">(请在正确答案前面打√)</span>
                    </div>
                </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">答案说明</div>
                <div class="col-sm-10">
                    <textarea name="description" class="form-control" width="80%" v-model="question.description"
                              placeholder="答案说明"></textarea>
                </div>
            </div>

            <!--<div class="form-group">-->
            <!--<div class="col-sm-2 control-label" style="width: 10%;">创建时间</div>-->
            <!--<div class="col-sm-10" style="width: 40%;">-->
            <!--<input type="text" class="form-control" width="80%" v-model="question.createTime" placeholder="创建时间"/>-->
            <!--</div>-->
            <!--<div class="col-sm-2 control-label" style="width: 10%;">创建人</div>-->
            <!--<div class="col-sm-10" style="width: 40%;">-->
            <!--<input type="text" class="form-control" width="80%" v-model="question.createName" placeholder="创建人"/>-->
            <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group">-->
            <!--<div class="col-sm-2 control-label" style="width: 10%;"></div>-->
            <!--<div class="col-sm-10" style="width: 40%;">-->
            <!--<input type="text" class="form-control" width="80%" v-model="question.state" placeholder=""/>-->
            <!--</div>-->
            <!--</div>-->
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/onlinestudy/question.js?_${.now?long}"></script>
</body>
</html>